<template>
  <el-switch v-model="language" size="large" active-value="en" active-text="english" inactive-value="zh"
             inactive-text="中文" />
  <h3>{{ $translate(language, 'hello_key') }}</h3>
  <h3>{{ $translate(language, 'name_key') }}</h3>
  <h3>{{ i18n }}</h3>
</template>
  
<script setup>
  import { ref, inject } from "vue";
  const language = ref("zh");


  const i18n = inject("i18n"); // 用inject接收
</script>